import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import liveMangmentRouter from './modules/live-mangment'
import example from './modules/example'

// meta: { title: '首页', icon: 'Avatar',svgIcon:'live-svg' affix: true, show: true, hidden: true, keepAlive:true }
// meat:
// icon:Element-icon图标
// svgIcon：自定义icon图标
// icon与svgIcon只能存在一个
// show:是控制页面中是否展示标题
// hidden:控制菜单栏是否显示
// affix： tag标签是否锁定
// keepAlive: 是否缓存

export const constantRoutes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      title: '登录'
    }
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404.vue'),
    meta: {
      title: '404'
    }
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401.vue'),
    meta: {
      title: '401'
    }
  },
  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    redirect: '/home',
    meta: { title: '首页', icon: 'el-icon-s-home', affix: true, show: false, hidden: true },
    children: [
      {
        path: 'home',
        component: () => import('@/views/home/index.vue'),
        name: 'Home',
        meta: { title: '首页', icon: 'el-icon-s-home', affix: true, show: false }
      }
    ]
  },
  liveMangmentRouter,
  example
]

export const asyncRoutes = []

export const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes
})

export default router
